<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>主页</title>
  <link href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" rel="stylesheet">
  <link href="${pageContext.request.contextPath}/font-awesome-4.7.0/css/font-awesome.min.css" type="text/css" rel="stylesheet">
  <script src="${pageContext.request.contextPath}/js/jquery-3.5.1.min.js"></script>
  <link href="${pageContext.request.contextPath}/css/news.css" type="text/css" rel="stylesheet">
  <style type="text/css">
      *{
          margin: 0px;
          padding: 0px;
      }
  </style>
</head>
<body >
<script type="text/javascript">
    <%--let begin = 0 ;--%>
    <%--function discuss( id ){--%>
    <%--    // 此时的id ，就是 内容的id--%>
    <%--    &lt;%&ndash;$.post("${pageContext.request.contextPath}/content/detail" , {contentId:id} )&ndash;%&gt;--%>
    <%--    window.location = "${pageContext.request.contextPath}/content/detail?id=" + id ;--%>
    <%--}--%>

    <%--$(function(){--%>
    <%--    // 获取用户信息--%>
    <%--    $.post("${pageContext.request.contextPath}/user/getInfo" , function(responseData){--%>
    <%--        if( responseData.status == -1 ){--%>
    <%--            $("#username").css("display" , "none") ;--%>
    <%--            $("#zhuce").css("display" , "block") ;--%>
    <%--            $("#login").css("display" , "block") ;--%>
    <%--            $("#register").css("display" , "none") ;--%>
    <%--        }else if(responseData.status == 0){--%>
    <%--            $("#login").css("display" , "none") ;--%>
    <%--            $("#zhuce").css("display" , "none") ;--%>
    <%--            $("#userInfo").css("display" , "block") ;--%>
    <%--            $("#register").css("display" , "block") ;--%>
    <%--            $("#username").text(responseData.data.username) ;--%>
    <%--            $("#publish_content").click(function(){--%>
    <%--                window.location = "${pageContext.request.contextPath}/publish_content.jsp"--%>
    <%--            })--%>
    <%--        }--%>
    <%--    } , "JSON") ;--%>

    <%--    $.post("${pageContext.request.contextPath}/content/list" ,{num:begin} ,  function (responseData){--%>
    <%--        console.log( responseData ) ;--%>
    <%--        if( responseData.status == 0 ){--%>
    <%--            // 此时证明是成功的--%>
    <%--            let datas = responseData.data ;  // 此时是数组--%>
    <%--			let pagesize=10;--%>
    <%--			let pagenum=Math.ceil(datas.length/pagesize);--%>
    <%--            for( let i = 0 ; i < datas.length ; i++ ) {--%>
    <%--                let xxx = datas[i] ;--%>
    <%--                // 创建一个div ，向 div 中填充内容--%>
    <%--                let e = $("<div style=\"margin-bottom: 10px;box-shadow: 0px 1px 3px #2d2c2c ;\" onclick='discuss("+xxx.id+")'>\n" +--%>
    <%--                    "                <div >\n" +--%>
    <%--                    "                    <div style=\"text-align: left ; padding-left: 10px; padding-top: 10px\">" + xxx.user.username + "</div>\n" +--%>
    <%--                    "                    <div style=\"text-align: center\">" + xxx.content + "</div>\n" +--%>
    <%--                    "                </div>\n" +--%>
    <%--                    "                <div style=\"text-align: right ; padding-bottom: 10px ; padding-right: 10px;\">\n" +--%>
    <%--                    "                   " + xxx.publishTime + " <i class='fa fa-thumbs-up'></i>&nbsp;" + xxx.likeCount + "\n" +--%>
    <%--                    "                </div>\n" +--%>
    <%--                    "            </div>");--%>

    <%--                // 追加一个元素--%>
    <%--                $("#contentList").append( e ) ;--%>
    <%--            }--%>
    <%--        }--%>
    <%--    } , "JSON") ;--%>
    <%--})--%>

</script>
<div style="z-index: 99;width:100%;height: 60px;position: fixed;overflow:hidden;margin:0;background-color: #ffffff">
  <div class="head row" style="height: 50px ; line-height: 50px ;font-size: 20px;
top: 10px ;box-shadow: 0px 1px 3px #dedede ; width: 100%;display: flex; padding: 5px;position: fixed;
"><div class="col-md-2"></div>
	<div class=" col-md-1" ><a href="homepage.jsp" ><i class="fa fa-home fa-fw" aria-hidden="true"></i>首页</a> </div>
	<div class="search bar7 col-md-3" style="font-size: 14px">
	  <form>
		<input type="text" placeholder="搜索" name="crid">
		<button type="submit"><i class="fa fa-search" style=";margin-right: 8px;margin-top: 15px;position: relative"></i> </button>
	  </form>
	</div>
	<div class="col-md-1"></div>
	<div class="col-md-2" style="font-size: 20px">
	  <a href="login.jsp" id="login" style="margin-right: 10px"><i class="fa fa-sign-in"></i>登录</a>
	  <a href="#" id="zhuce"><i class="fa fa-registered"></i>注册</a>
	  <a href="#" id="username"></a>
	  <a href="#" id="register"4 class="btn btn-danger"><i class="fa fa-sign-out"></i>注销</a>
	</div>
	<div class="col-md-1"><a href="publish.jsp" style="" class=""><i class="fa fa-pencil fa-fw"></i>发布</a></div>
	<div class="col-md-2"></div>
  </div>

</div>
<div style="height: 20px"></div>
<div class="row" style="margin-top: 5% ; width: 100%;z-index:-1">
  <div class="col-md-3 " style="text-align: right; font-weight: bolder">
  </div>
  <div class="col-md-6 " id="contentList" style="background-color: white">
	搜索结果
	<nav aria-label="Page navigation pagination-lg" style="margin-left: 46%">
	  <ul class="pagination">
		<li>
		  <a href="#" aria-label="Previous">
			<span aria-hidden="true">&laquo;</span>
		  </a>
		</li>
		<li><a href="#">1</a></li>
		<li><a href="#">2</a></li>
		<li><a href="#">3</a></li>
		<li><a href="#">4</a></li>
		<li><a href="#">5</a></li>
		<li>
		  <a href="#" aria-label="Next">
			<span aria-hidden="true">&raquo;</span>
		  </a>
		</li>
	  </ul>
	</nav>
  </div>
  <div class="col-md-3 ">

  </div>

</div>
<script>
    var oLis=document.getElementsByTagName("span");
    var i,j;
    var length=oLis.length;
    console.log(length);
    for(i=0;i<length-2;i++){
        oLis[i].onclick=function(){
            for(j=0;j<length-2;j++){
                oLis[j].className="";
            }
            this.className+="active";
        }
    }
</script>
</body>
</html>
